package
{
	import com.fellong.flash.flar.object.FlarObject;

	import flash.events.Event;

	import org.papervision3d.lights.PointLight3D;
	import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.primitives.Cube;
	
	public class FlarLight extends FlarObject
	{
		private var _light:PointLight3D = new PointLight3D();
		
		public function FlarLight()
		{
			super();
			_light = new PointLight3D();
			_light.x = 0;
			_light.y = 0;
			_light.z = 0;
		}
		
		public function get light():PointLight3D
		{
			return _light;
		}
		
		override protected function onMARKER_ADDED( event:Event ):void
		{
			super.onMARKER_ADDED( event );
			this.pivot.addChild(_light);
		}
		
		override protected function onMARKER_UPDATED( event:Event ):void
		{
			super.onMARKER_UPDATED( event );
			_light.x = this.x;
			_light.y = this.y;
			_light.z = this.z;
		}

		override protected function onMARKER_REMOVED( event:Event ):void
		{
			super.onMARKER_REMOVED( event );
			this.pivot.removeChild(_light);
		}

	}
}